If we assign any value to the testRevert function that is higher or

equal to 100, then the function throws an exception and the value is

not assigned to the state variable.

2.5.18.3 Assert

The assert function should only be used to test for internal errors,

and to check the invariants, for example, the overflow and underflow

conditions. assert() is just there to prevent anything really bad from

happening. The following is an example:

// SPDX-License-Identifier: SOME IDENTIFIER

pragma solidity ^0.8.10;

contract AssertFunctionTest {

uint someValue;

function testAssert(uint localValue) public {

assert(localValue < 100);

someValue = localValue;

}

function retrieveValue() public view returns (uint) {

return someValue;

}

}

2.5.18.4 Try/Catch

Try/Catch can only be used in calling the external functions or when

creating a contract. Please check the following code where a failure

in an external is caught using a try/catch statement:

// SPDX-License-Identifier: SOME IDENTIFIER

pragma solidity ^0.8.10;

contract ExchangeRates{

constructor(uint currencyInINR){

currencyInINR/75;

}